package com.xuan.friend.controller;


import com.xuan.common.core.controller.BaseController;
import com.xuan.common.core.domain.R;
import com.xuan.common.file.domain.OSSResult;
import com.xuan.friend.aop.CheckUserStatus;
import com.xuan.friend.service.file.FileService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/file")
@CheckUserStatus
public class FileController extends BaseController {

    @Resource
    private FileService fileService;

    @CheckUserStatus
    @PostMapping("/upload")
    public R<OSSResult> upload(MultipartFile file) {
        return R.ok(fileService.upload(file));
    }

}
